package com.atguigu.dao.impl;

import com.atguigu.dao.UserDao;
import com.atguigu.pojo.User;

public class UserDaoImpl extends BaseDaoimpl<User> implements UserDao{

	@Override
	public int saveUser(User user) {
		String sql = "insert into t_user (`username`,`password`,`email`) values(?,?,?)";
		return update(sql, user.getUsername(),user.getPassword(),user.getEmail());
	}

	@Override
	public User getformNameAndPassword(String username, String password) {
		String sql = "select `id`,`username`,`password`,`email` from t_user where username=? and password=?";
		
		return getOne(sql, username,password);
	}

	@Override
	public User getfromName(String username) {
		String sql = "select  `id`,`username`,`password`,`email` from t_user where username=? ";
		return getOne(sql, username);
	}

}
